package com.cn.domain;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * 用户组表
 * @author Hang
 * @date 2016年2月29日上午10:49:29
 * @version
 */
@Entity
@Table(name = "groop")
public class Groop {
	//组ID
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "gid", nullable = false, length = 50, unique = true)
	private int gid;
	//组名
	@Column(name = "gname", nullable = false, length = 10)
	private String gname;
	//组类型
	@Column(name = "gtype", nullable = false, length = 5)
	private int gtype;
	//组备注
	@Column(name = "gnote", nullable = true, length = 255)
	private String gnote;
	//组权限
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "pggroop")
	private List<PowerGroup> powerGroups;
	//
	@OneToMany(cascade = CascadeType.ALL, mappedBy = "groop")
	private List<Users> users;
	
	public Groop() {
		super();
	}

	public Groop(int gid, String gname, int gtype, String gnote,
			List<PowerGroup> powerGroups, List<Users> users) {
		super();
		this.gid = gid;
		this.gname = gname;
		this.gtype = gtype;
		this.gnote = gnote;
		this.powerGroups = powerGroups;
		this.users = users;
	}

	public int getGid() {
		return gid;
	}

	public void setGid(int gid) {
		this.gid = gid;
	}

	public String getGname() {
		return gname;
	}

	public void setGname(String gname) {
		this.gname = gname;
	}

	public int getGtype() {
		return gtype;
	}

	public void setGtype(int gtype) {
		this.gtype = gtype;
	}

	public String getGnote() {
		return gnote;
	}

	public void setGnote(String gnote) {
		this.gnote = gnote;
	}

	public List<PowerGroup> getPowerGroups() {
		return powerGroups;
	}

	public void setPowerGroups(List<PowerGroup> powerGroups) {
		this.powerGroups = powerGroups;
	}

	public List<Users> getUsers() {
		return users;
	}

	public void setUsers(List<Users> users) {
		this.users = users;
	}
	
}
